<?php
if($mc->get($fromUsername . "_do") == "鸡鸡")
    {
    
    
      $mc->set($fromUsername . "_do", "鸡鸡", 0, 6000);  
    
    do
{
 $url = "http://api.idickyt.com/simsimi.json?randno=".rand(1,1000000000)."&request=".urlencode($form_Content);
  $f = new SaeFetchurl();
  $result = $f->fetch($url);
        
  $result=json_decode($result,true);
  
   $data=$result['sentence_resp'];
    
    $checkdata=str_replace(" ","",$data);
    $domain=strstr($checkdata, '微信');
}
while($domain!=NULL);
    
    if($data!='')
      {
      $resultStr = sprintf($textTpl, $fromUsername, $toUsername,"text",$data);
      echo $resultStr;
      exit;
      }
    
    else 
    {      
        $ran=rand(1,6);
         $data="这个我真不懂。嘻嘻\n";
         switch($ran)
         {      
                case 1:$data.="么么哒";break;
                  
                case 2:$data.="想你了";break;
                   
                case 3:$data.="花开富贵";break;
                   
                case 4:$data.="生日快乐";break;
                   
                case 5:$data.="我爱你";break;
                   
                case 6:$data.="恭喜发财";break;
                
                default:$data.="年年有余";
              }
      $resultStr = sprintf($textTpl, $fromUsername, $toUsername,"text",$data);
      echo $resultStr;
      exit;
  
    }
    }
     if($form_Content == "鸡鸡")
            {
            $mc->delete($fromUsername . "_do", 0);    
            $mc->set($fromUsername . "_do", "鸡鸡", 0, 6000);  
            
            $contentStr = "小黄鸡：\n"."亲爱的".$address_book['student_name']."\n我是小simsimi!快来调戏我吧\n\n菜单提示：回复【菜单】退出simsimi"; 
          
            $resultStr = sprintf($textTpl, $fromUsername, $toUsername,"text",$contentStr);
            echo $resultStr;
            exit;
            }

?>